﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenExpressApp.Types;

namespace OpenExpressApp.MetaAttribute
{
    [AttributeUsage(AttributeTargets.Class)]
    public class CommandAttribute : Attribute
    {
        public CommandAttribute(string id)
        {
            this.Id = id;
            this.Category = CommandCategory.RecordEdit;
            this.ModuleType = ModuleType.Unspecified;
            this.CommandType = CommandType.Simple;
        }
        /// <summary>
        /// 自动生成一个不重复的name
        /// </summary>
        public CommandAttribute() : this(null) { }
        //: this(Guid.NewGuid().ToString())

        /// <summary>
        /// 如果使用空构造函数，则Name为null，
        /// 不再唯一，若想获取唯一标记，请调用方法GetUniqueName
        /// </summary>
        public string Id { get; set; }
        public string Label { get; set; }
        public string ToolTip { get; set; }
        public string ImageName { get; set; }
        public ViewType TargetViewType { get; set; }
        /// <summary>
        /// 这个命令显示在哪个类型的工具条上
        /// </summary>
        public ToolbarType ToolbarType { get; set; }
        public ModuleType ModuleType { get; set; }
        public Type TargetObjectType { get; set; }
        /// <summary>
        /// 生成窗体后根据View来自动调用的Command
        /// 该命令是否自动启动。
        /// </summary>
        public bool AutoExecuting { get; set; }
        public bool IngoreIsExecuting { get; set; }
        /// <summary>
        /// 命令的类别
        /// </summary>
        public CommandCategory Category { get; set; }
        /// <summary>
        /// 命令在同一个ToolBar上的分组名
        /// </summary>
        public string Group { get; set; }
        public CommandType CommandType { get; set; }
        ///// <summary>
        ///// 如果有相同的command已经出现在toolbar中时，
        ///// 是不是把它们放在一个菜单里面。然后在Name之后加上类型名称以区分。
        ///// </summary>
        //public bool MergeInToolbarIfSame { get; set; }
    }

    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
    public class NotAllowNewAttribute : Attribute { }

    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
    public class NotAllowEditAttribute : Attribute { }

    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
    public class NotAllowRemoveAttribute : Attribute { }

    /// <summary>
    /// CopyAndNew对标有对标有Column和Association属性的列进行拷贝，如果加了NotCopy标识，则不复制此当前属性
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, Inherited = false)]
    public class NotCopyAttribute : Attribute { }
}